package com.qfedu.springmvc.job.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.HttpServletBean;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @auther asus
 * @date 2022/5/2 15:46
 */
@Controller  //标识该类作为一个控制器
@RequestMapping("show")
public class ShowController{
    @RequestMapping("test")
    public ModelAndView test1(@RequestParam(value = "name",required = false) String name, @RequestParam(value = "age",required = false)Integer age,@RequestParam(value = "address",required = false)String address){
        System.out.println("Hello SpringMVC");
        // 返回的字串，就是转发到的路径 视图的地址
        ModelAndView modelAndView = new ModelAndView("showMassages");
        modelAndView.addObject("name",name);
        modelAndView.addObject("age",age);
        modelAndView.addObject("address",address);
        return modelAndView;
    }
}
